<%-- 
    Document   : PersonalSpace
    Created on : Nov 22, 2009, 12:13:28 PM
    Author     : zhi
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">


<%@page import="Service.*, javabeans.*, java.util.*"%>
<%!
    List<Plan> personalPlanList;
    List<GroupPlan> groupPlanList;

%>

<%
    String userid = (String)request.getAttribute("userid");
    if(userid==null)
        userid = request.getParameter("userid");
    MemberService ms = new MemberServiceImpl();
    System.out.println(userid);
    Member member = ms.getMember(userid);
    System.out.println(member);
    personalPlanList = member.getPersonalplans();
    groupPlanList = ms.getGroupPlanList(member.getId());
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="Stylesheet" type="text/css" href="./extjs3.0/resources/css/ext-all.css"/>
        <link rel="Stylesheet" type="text/css" href="./css/personal-space.css"/>
        
        <script type="text/javascript" src="./extjs3.0/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="./extjs3.0/ext-all-debug.js"></script>
        <script type="text/javascript" src="./js/personal-space-newplan.js"></script>
        <script type="text/javascript" src="./js/personal-space-newgroupplan.js"></script>
        <script type="text/javascript">
            var userid = '<%= userid %>';
        </script>
        <title>Personal Space - Plan your trip and let's go!</title>
    </head>
    <body tracingsrc="personalPage.png" tracingopacity="60">
        <table width="1000" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="406" colspan="3"><img src="image/personalspace/head.gif" width="1000" height="406" align="top"></td>
          </tr>
          <tr>
            <td width="68" height="377" rowspan="2" align="left" valign="top"><img src="image/personalspace/blankLeft.gif" width="68" height="377"></td>
            <td width="208" height="85" align="left" valign="top"><table width="208" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="208" height="28"><input type="image" src="image/personalspace/createNewPlan.gif" width="155" height="21" align="absmiddle" onClick="newPersonalPlan()"></td>
              </tr>
              <tr>
                <td width="208" height="28"><input type="image" src="image/personalspace/createNewGroup.gif" width="155" height="21" align="absmiddle" onClick="newGroupPlan()"></td>
              </tr>
              <tr>
                <td width="208" height="28"><input type="image" src="image/personalspace/viewAllGroups.gif" width="155" height="21" align="absmiddle" onClick="location.href='ViewAllGroupPlan.jsp?userid='+userid"></td>
              </tr>
            </table></td>
            <td width="851" rowspan="2" align="left" valign="top"><table width="724" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="724" height="163" align="left" valign="top">
                        <table width="724" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                      <%
                            // get all the plan and display
                            Plan plan;
                            int i = 0;
                            for(;i<personalPlanList.size();i++) {
                                if(i==5) break;
                                plan = personalPlanList.get(i);
                      %>
                      <td width="145" height="145" align="center" valign="middle" background="image/personalspace/planPic.gif" onClick="location.href='PersonalPlan.jsp?planid=<%= plan.getPlanid()%>&userid='+userid" style="cursor:pointer; color:#737373; font-family: verdanna; font-size: 13px;">
                        <%= plan.getPlanname()%>
                      </td>
                    <%
                            }
                            for(int j=0;j<5-i;j++) {
                    %>
                      <td width="145" height="145" align="center" valign="middle"></td>
                    <%
                            }
                    %>
                  </tr>
                  <tr>
                      <td height="18" colspan="5" align="center" style="color:#737373; font-family: verdanna; font-size: 13px;"><input type="image" src="image/personalspace/prev.gif" width="39" height="18"> 1 2 3 <input type="image" src="image/personalspace/next.gif" width="40" height="18"></td>
                  </tr>
                </table>
                        </td>
              </tr>
              <tr>
                <td width="724" height="214" align="left" valign="top"><table width="724" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="724" height="75"><img src="image/personalspace/myGroups.gif" width="724" height="75"></td>
                  </tr>
                  <tr>
                    <td width="724" height="163" align="left" valign="top">
                                                <table width="724" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                      <%
                            // get all the plan and display
                            GroupPlan groupplan;
                            i = 0;
                            for(;i<groupPlanList.size();i++) {
                                if(i==5) break;
                                groupplan = groupPlanList.get(i);
                      %>
                      <td width="145" height="145" align="center" valign="middle" background="image/personalspace/planPic.gif" onClick="location.href='GroupPlan.jsp?groupplanid=<%= groupplan.getGroupplanid()%>&userid='+userid" style="cursor:pointer; color:#737373; font-family: verdanna; font-size: 13px;">
                        <%= groupplan.getGroupplanname()%>
                      </td>
                    <%
                            }
                            for(int j=0;j<5-i;j++) {
                    %>
                      <td width="145" height="145" align="center" valign="middle"></td>
                    <%
                            }
                    %>
                  </tr>
                  <tr>
                    <td height="18" colspan="5" align="center" style="color:#737373; font-family: verdanna; font-size: 13px;"><input type="image" src="image/personalspace/prev.gif" width="39" height="18"> 1 2 3 <input type="image" src="image/personalspace/next.gif" width="40" height="18"></td>
                  </tr>
                </table>
                                </td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td width="208" height="292" align="left" valign="top"><img src="image/personalspace/picLeft.gif" width="208" height="292"></td>
          </tr>
          <tr>
            <td height="118" colspan="3"><img src="image/personalspace/bottom.gif" width="1000" height="118"></td>
          </tr>
        </table>
    </body>
</html>
